package com.panfeng.xcloud.boss.provider.member.dao.mapper;

import com.panfeng.xcloud.boss.provider.member.dto.response.ActiveTaskProgressRespDTO;
import com.panfeng.xcloud.dao.member.entity.UserFamilyTree;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface UserFamilyTreeMapperExt {

    List<String> findUserActiveHistoryNotExistUserId(String userId);

    String findUserFamilyTreeLock(String userId);

    ActiveTaskProgressRespDTO queryActivityTaskProgress(@Param("userId") String userId);

    /**
     * 通过userId查询用户族谱
     *
     * @param userId
     * @return
     */
    List<UserFamilyTree> selectUserFamilyInfoByUserId(String userId);

    /**
     * 从族谱中查询当前用户所在位置
     *
     * @param userId
     * @return
     */
    UserFamilyTree selectCurrentUserFromUserFamily(String userId);

    /**
     *
     * 查询userid下的一级子节点
     *
     * @param userId
     * @param userNodeLevel 当前userId的所属层级的下一级
     * @return
     */
    List<UserFamilyTree> selectOneLevelChildsByUserIdAndLevel(@Param("userId") String userId, @Param("userNodeLevel") int userNodeLevel);

    /**
     * 批量查询族谱信息
     *
     * @param insertFamilyTreeList
     * @return
     */
    int batchInertUserFamilyInfo(@Param("insertFamilyTreeList") List<UserFamilyTree> insertFamilyTreeList);

    /**
     * 查询内部邀请码下的所有子节点
     *
     * @return
     */
    List<UserFamilyTree> selectOneLevelChildsByInnerInviteCode();

    int insertSelective(UserFamilyTree record);

    String querySuperFriend(@Param("userId") String userId, @Param("number") Integer number);

    Integer queryRealnameCertifiedFriendsCountByUserId(@Param("userId") String userId);

    Integer findChildrenCountByUserId(String userId);

}